package org.byqh.dqeai.config.datasource;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

@Configuration
public class DataSourceConfig {

    @Primary
    @Bean(name = DataSourceNames.Default)
    @ConfigurationProperties(prefix = "spring.datasource.druid.default")
    public DataSource getDateSourceKingbase() {
        return DataSourceBuilder.create().type(DruidDataSource.class).build();
    }
}